package com.woniu.micropropertyserver.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;;

import com.woniu.microcommonsserver.entity.PropertyFaceCheck;
import com.woniu.micropropertyserver.bean.DployPface;
import com.woniu.micropropertyserver.mapper.PropertyFaceMapper;
import com.woniu.micropropertyserver.service.IPropertyFaceCheckService;
import com.woniu.micropropertyserver.util.PageRest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
 * @author ：bb
 * @date ：Created in 2021/1/28 0028
 * @description：
 * @modified By：
 * @version: $
 */
@Transactional(readOnly = true)
@Service
public class PropertyFaceCheckServiceImpl implements IPropertyFaceCheckService {
  @Resource
 private PropertyFaceMapper propertyFaceMapper;
    @Override
    public List<DployPface> findAll() {
        return null;
    }

    @Override
    public PageInfo<DployPface> findByParams(PageRest pageRest, DployPface dployPface) {
         System.out.println(dployPface);
          return PageHelper.startPage(pageRest.getPageNum(),pageRest.getPageSize()).doSelectPageInfo(()->propertyFaceMapper.findByParams(pageRest,dployPface));
    }

    @Override
    @Transactional(isolation = Isolation.DEFAULT,rollbackFor = Exception.class)
    public int delInfo(Long[] ids) {
        return propertyFaceMapper.delInfo(ids);
    }

    @Override
    @Transactional(isolation = Isolation.DEFAULT,rollbackFor = Exception.class)
    public int updateAuth(Long[] ids, Date authorizeStartDate, Date authorizeEndDate, Integer bulid) {
        Date now = new Date();
        return propertyFaceMapper.updateAuth(ids,authorizeStartDate,authorizeEndDate,bulid,now);
    }

    @Override
    @Transactional(isolation = Isolation.DEFAULT,rollbackFor = Exception.class)
    public int saveInfo(PropertyFaceCheck propertyFaceCheck) {
        return propertyFaceMapper.saveInfo(propertyFaceCheck);
    }

    @Override
    public PropertyFaceCheck findOne(Long id) {
        return propertyFaceMapper.findOne(id);
    }
}
